#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
void fun(long long sum, int flag)
{
	if (flag == 0) {
		cout << "-";
	}
	int arr[1010];
	int i = 0;
	while (sum) {
		arr[i++] = sum % 16;
		sum /= 16;
	}
	for (int j = i - 1; j >= 0; j--) {
		if (arr[j] >= 0 && arr[j] <= 9) {
			cout << arr[j];
		}
		else if (arr[j] == 10) {
			cout << "A";
		}
		else if (arr[j] == 11) {
			cout << "B";
		}
		else if (arr[j] == 12) {
			cout << "C";
		}
		else if (arr[j] == 13) {
			cout << "D";
		}
		else if (arr[j] == 14) {
			cout << "E";
		}
		else if (arr[j] == 15) {
			cout << "F";
		}
	}
}
int main()
{
	char arr1[1010];
	char arr2[1010];
	while (cin >> arr1 >> arr2) {
		int flag1 = 0;
		int flag2 = 0;
		if (arr1[0] == '+' || arr1[0] >= '0' && arr1[0] <= 'F') {
			flag1 = 1;
		}
		if (arr2[0] == '+' || arr2[0] >= '0' && arr2[0] <= 'F') {
			flag2 = 1;
		}
		int len1 = strlen(arr1) - 1;
		int t1 = 1;
		int t2 = 1;
		if (arr1[0] >= '0' && arr1[0] <= 'F') {
			len1++;
			t1 = 0;
		}
		int len2 = strlen(arr2) - 1;
		if (arr2[0] >= '0' && arr2[0] <= 'F') {
			len2++;
			t2 = 0;
		}
		int a;
		long long sum1 = 0;
		long long sum2 = 0;
		for (int i = t1; i < strlen(arr1); i++) {
			if (arr1[i] == 'A') {
				a = 10;
			}
			else if (arr1[i] == 'B') {
				a = 11;
			}
			else if (arr1[i] == 'C') {
				a = 12;
			}
			else if (arr1[i] == 'D') {
				a = 13;
			}
			else if (arr1[i] == 'E') {
				a = 14;
			}
			else if (arr1[i] == 'F') {
				a = 15;
			}
			else {
				a = arr1[i] - '0';
			}
			len1--;
			sum1 += a * pow(16, len1);
		}
		for (int i = t2; i < strlen(arr2); i++) {
			if (arr2[i] == 'A') {
				a = 10;
			}
			else if (arr2[i] == 'B') {
				a = 11;
			}
			else if (arr2[i] == 'C') {
				a = 12;
			}
			else if (arr2[i] == 'D') {
				a = 13;
			}
			else if (arr2[i] == 'E') {
				a = 14;
			}
			else if (arr2[i] == 'F') {
				a = 15;
			}
			else {
				a = arr2[i] - '0';
			}
			len2--;
			sum2 += a * pow(16, len2);
		}
		if ((sum2 == sum1) && ((flag1 == 0 && flag2 == 1) || (flag1 == 1 && flag2 == 0))) {
			cout << 0 << endl;
			continue;
		}
		if (flag1==0) {
			sum1 = (-sum1);
		}
		if (flag2 == 0) {
			sum2 = (-sum2);
		}
		int flag3 = 1;
		long long sum = sum1 + sum2;
		if (sum < 0) {
			flag3 = 0;
			sum = (-sum);
		}
		fun(sum, flag3);
		cout << endl;
	}
	return 0;
}